mention in the docs that -1 is a valid value and what it means.
authorKristian Rietveld <kris@gtk.org>
Wed, 15 Oct 2003 20:18:01 +0000 (20:18 +0000)
committerKristian Rietveld <kristian@src.gnome.org>
Wed, 15 Oct 2003 20:18:01 +0000 (20:18 +0000)
Wed Oct 15 22:04:59 2003  Kristian Rietveld  <kris@gtk.org>

* gtk/gtkcombobox.c (gtk_combo_box_get_active),
(gtk_combo_box_set_active): mention in the docs that -1 is a valid
value and what it means.

* gtk/gtkcomboboxentry.c (gtk_combo_box_entry_init): set the active
item to -1 (default),
(gtk_combo_box_entry_active_changed): do nothing when the index is
< 0.

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gtk/gtkcombobox.c
gtk/gtkcomboboxentry.c

index 45e3897b47fe87acf407db441e146576f5805d14..f15baa601c2234be7ce6efb4376d7ff6838cf1f9 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+Wed Oct 15 22:04:59 2003  Kristian Rietveld  <kris@gtk.org>
+
+       * gtk/gtkcombobox.c (gtk_combo_box_get_active),
+       (gtk_combo_box_set_active): mention in the docs that -1 is a valid
+       value and what it means.
+
+       * gtk/gtkcomboboxentry.c (gtk_combo_box_entry_init): set the active
+       item to -1 (default),
+       (gtk_combo_box_entry_active_changed): do nothing when the index is
+       < 0.
+
 Tue Oct 14 16:10:21 2003  Jonathan Blandford  <jrb@redhat.com>
 
        * gtk/gtkcombobox.c (gtk_combo_box_set_active_iter): New function
index 45e3897b47fe87acf407db441e146576f5805d14..f15baa601c2234be7ce6efb4376d7ff6838cf1f9 100644 (file)
@@ -1,3 +1,14 @@
+Wed Oct 15 22:04:59 2003  Kristian Rietveld  <kris@gtk.org>
+
+       * gtk/gtkcombobox.c (gtk_combo_box_get_active),
+       (gtk_combo_box_set_active): mention in the docs that -1 is a valid
+       value and what it means.
+
+       * gtk/gtkcomboboxentry.c (gtk_combo_box_entry_init): set the active
+       item to -1 (default),
+       (gtk_combo_box_entry_active_changed): do nothing when the index is
+       < 0.
+
 Tue Oct 14 16:10:21 2003  Jonathan Blandford  <jrb@redhat.com>
 
        * gtk/gtkcombobox.c (gtk_combo_box_set_active_iter): New function
index 45e3897b47fe87acf407db441e146576f5805d14..f15baa601c2234be7ce6efb4376d7ff6838cf1f9 100644 (file)
@@ -1,3 +1,14 @@
+Wed Oct 15 22:04:59 2003  Kristian Rietveld  <kris@gtk.org>
+
+       * gtk/gtkcombobox.c (gtk_combo_box_get_active),
+       (gtk_combo_box_set_active): mention in the docs that -1 is a valid
+       value and what it means.
+
+       * gtk/gtkcomboboxentry.c (gtk_combo_box_entry_init): set the active
+       item to -1 (default),
+       (gtk_combo_box_entry_active_changed): do nothing when the index is
+       < 0.
+
 Tue Oct 14 16:10:21 2003  Jonathan Blandford  <jrb@redhat.com>
 
        * gtk/gtkcombobox.c (gtk_combo_box_set_active_iter): New function
index 45e3897b47fe87acf407db441e146576f5805d14..f15baa601c2234be7ce6efb4376d7ff6838cf1f9 100644 (file)
@@ -1,3 +1,14 @@
+Wed Oct 15 22:04:59 2003  Kristian Rietveld  <kris@gtk.org>
+
+       * gtk/gtkcombobox.c (gtk_combo_box_get_active),
+       (gtk_combo_box_set_active): mention in the docs that -1 is a valid
+       value and what it means.
+
+       * gtk/gtkcomboboxentry.c (gtk_combo_box_entry_init): set the active
+       item to -1 (default),
+       (gtk_combo_box_entry_active_changed): do nothing when the index is
+       < 0.
+
 Tue Oct 14 16:10:21 2003  Jonathan Blandford  <jrb@redhat.com>
 
        * gtk/gtkcombobox.c (gtk_combo_box_set_active_iter): New function
index 45e3897b47fe87acf407db441e146576f5805d14..f15baa601c2234be7ce6efb4376d7ff6838cf1f9 100644 (file)
@@ -1,3 +1,14 @@
+Wed Oct 15 22:04:59 2003  Kristian Rietveld  <kris@gtk.org>
+
+       * gtk/gtkcombobox.c (gtk_combo_box_get_active),
+       (gtk_combo_box_set_active): mention in the docs that -1 is a valid
+       value and what it means.
+
+       * gtk/gtkcomboboxentry.c (gtk_combo_box_entry_init): set the active
+       item to -1 (default),
+       (gtk_combo_box_entry_active_changed): do nothing when the index is
+       < 0.
+
 Tue Oct 14 16:10:21 2003  Jonathan Blandford  <jrb@redhat.com>
 
        * gtk/gtkcombobox.c (gtk_combo_box_set_active_iter): New function
index 3632786ae637bccdc29226c81836b5d7a61ebbdb..e221ad04e1024946bdd2da1afe08cf4a1b2d8e33 100644 (file)
@@ -2316,9 +2316,11 @@ gtk_combo_box_set_column_span_column (GtkComboBox *combo_box,
  * gtk_combo_box_get_active:
  * @combo_box: A #GtkComboBox.
  *
- * Returns the index of the currently active item.
+ * Returns the index of the currently active item, or -1 if there's no
+ * active item.
  *
- * Return value: An integer which is the index of the currently active item.
+ * Return value: An integer which is the index of the currently active item, or
+ * -1 if there's no active item.
  *
  * Since: 2.4
  */
@@ -2333,7 +2335,8 @@ gtk_combo_box_get_active (GtkComboBox *combo_box)
 /**
  * gtk_combo_box_set_active:
  * @combo_box: A #GtkComboBox.
- * @index: An index in the model passed during construction.
+ * @index: An index in the model passed during construction, or -1 to have
+ * no active item.
  *
  * Sets the active item of @combo_box to be the item at @index.
  *
index 35575c2be0250ef08f5181569fdc5c60e2c4ac85..6cd0afe3a7b4cfe691e268e7817113aedab253e0 100644 (file)
@@ -128,6 +128,8 @@ gtk_combo_box_entry_init (GtkComboBoxEntry *entry_box)
   gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (entry_box),
                               entry_box->priv->text_renderer, TRUE);
 
+  gtk_combo_box_set_active_item (GTK_COMBO_BOX (entry_box), -1);
+
   g_signal_connect (entry_box->priv->entry, "changed",
                     G_CALLBACK (gtk_combo_box_entry_contents_changed),
                     entry_box);
@@ -188,9 +190,7 @@ gtk_combo_box_entry_active_changed (GtkComboBox *combo_box,
                                    gtk_combo_box_entry_contents_changed,
                                    combo_box);
 
-  if (index < 0)
-    gtk_entry_set_text (GTK_ENTRY (entry_box->priv->entry), "");
-  else
+  if (index >= 0)
     {
       gchar *str = NULL;
       GtkTreeIter iter;